import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/components/Home.vue'
import NewPage from '../views/NewPage.vue' // 导入新创建的页面组件
import ArticlesView from '../views/ArticlesView.vue' // 文章列表页面
import ArticleDetailView from '../views/ArticleDetailView.vue' // 文章详情页面

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/new-page',
      name: 'new-page',
      component: NewPage, // 配置新页面的路由
    },
    {
      path: '/articles',
      name: 'articles',
      component: ArticlesView, // 文章列表页面
    },
    {
      path: '/articles/:id',
      name: 'article-detail',
      component: ArticleDetailView, // 文章详情页面
    },
    {
      path: '/',
      name: 'home',
      component: Home,
    },
    {
      path:'/MyHome',
      name:'myhome',
      component: Home
    },
    // 修正逗号格式，保证 JSON 格式正确
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
    },
  ],
})

export default router
